package com.boot.fx;

import javafx.scene.Parent;
import javafx.scene.control.ProgressBar;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
/**
 * @Title: 默认启动动画界面
 * @Description:
 * 1可以重写此项以创建自己的初始窗格父节点。
 * 2是否显示闪屏动画
 * 3更改启动图片
 * @ClassName: com.boot.fx.SplashScreen.java
 * @author: jingfan
 * @date:  2025-04-21 15:48
 * @Copyright 2024-2035 公司名称 - Powered By 自研
 * @version V1.0
 */
public class SplashScreen {

	private static final String DEFAULT_IMAGE = "splash/javafx.png";

	public Parent getParent() {
		final ImageView imageView = new ImageView(ResourceUtil.getResource(getImagePath()).toExternalForm());
		final ProgressBar splashProgressBar = new ProgressBar();
		splashProgressBar.setPrefWidth(imageView.getImage().getWidth());
		final VBox vbox = new VBox();
		vbox.getChildren().addAll(imageView, splashProgressBar);
		return vbox;
	}

	public boolean visible() {
		return true;
	}

	public String getImagePath() {
		return DEFAULT_IMAGE;
	}

}
